//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media.Media3D;
using OpenLS.Chart.UI.Internals;

namespace OpenLS.Chart.UI
{
    sealed class ProjectorFactory: IMultiValueConverter
    {
        #region IMultiValueConverter Members

        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var c = new CameraConverter();
            var camera = (Camera) c.Convert(values, typeof (Camera), parameter, culture);
            double width = System.Convert.ToDouble(values[8]);
            double height = System.Convert.ToDouble(values[9]);
            return new Camera3D2DProjector(camera, new Size(width, height));
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
